/*
 * @Author: 周海 zhouhaib@yonyou.com
 * @Date: 2022-12-17 11:32:53
 * @LastEditors: 周海 zhouhaib@yonyou.com
 * @LastEditTime: 2022-12-18 13:09:48
 */
import request from '@/utils/request'
import {SysJobDomain} from '@/type.d/monitor/sysjob';

// 查询定时任务调度列表
export function listSysjob(query: SysJobDomain) {
  return request('/monitor/sysjob/list',{
    method: 'get',
    params: query
  })
}

// 查询定时任务调度详细
export function getSysjob(jobId: string) {
  return request('/monitor/sysjob/' + jobId,{
    method: 'get'
  })
}

// 新增定时任务调度
export function addSysjob(data: SysJobDomain) {
  return request('/monitor/sysjob',{
    method: 'post',
    data: data
  })
}

// 修改定时任务调度
export function updateSysjob(data: SysJobDomain) {
  return request('/monitor/sysjob',{
    method: 'put',
    data: data
  })
}

// 删除定时任务调度
export function delSysjob(jobId: string) {
  return request('/monitor/sysjob/' + jobId,{
    method: 'delete'
  })
}


// 任务状态修改
export function changeJobStatus(jobId: string, status: string) {
  const data = {
    jobId,
    status
  }
  return request('/monitor/sysjob/changeStatus',{
    method: 'put',
    data: data
  })
}


// 定时任务立即执行一次
export function runJob(jobId: string, jobGroup: string) {
  const data = {
    jobId,
    jobGroup
  }
  return request('/monitor/sysjob/run',{
    method: 'put',
    data: data
  })
}
